package com.ytjj.qmyx.admin.controller;

import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.annotation.OperLog;
import com.ytjj.qmyx.admin.constants.SysLogConstants;
import com.ytjj.qmyx.admin.model.request.BankerSiteRequest;
import com.ytjj.qmyx.admin.service.BankerSiteService;
import com.ytjj.qmyx.mall.model.BankerSite;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 *
 * 
 * @Version: 1.0
 *
 * 供应商官网 模块
 */
@RestController
@RequestMapping("/bankerSite")
public class BankerSiteController {

    @Autowired
    private BankerSiteService bankerSiteService;

    @PostMapping("/list")
    @OperLog(operModule = "供应商官网", operDesc = "列表", operType = SysLogConstants.OPERATION_SELECT)
    public String selectList(@RequestBody BankerSiteRequest bankerSiteRequest) {
        return bankerSiteService.newSelectList(bankerSiteRequest);
    }

    @PostMapping("/updateStatus")
    @OperLog(operModule = "供应商官网", operDesc = "修改状态", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult updateStatus(@RequestBody BankerSiteRequest bankerSiteRequest) {
        return CommonResult.success(bankerSiteService.updateStatus(bankerSiteRequest));
    }

    @PostMapping("/updateBankerSite")
    @OperLog(operModule = "供应商官网", operDesc = "修改官网信息", operType = SysLogConstants.OPERATION_UPDATE)
    public CommonResult updateBankerSite(@RequestBody BankerSite bankerSite) {
        Integer count = bankerSiteService.updateBankerSite(bankerSite);
        if(count > 0) {
            return CommonResult.success(count);
        } else {
            return CommonResult.failed();
        }
    }

}
